<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method='html' encoding='UTF-8' doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" indent='yes'/>

	<!-- xml filesources -->
	<xsl:variable name="src_head" select="document(root/filehead/@src)"/>
	<xsl:variable name="src_head_ie" select="document(root/filehead_ie/@src)"/>
	<xsl:variable name="src_header" select="document(root/fileheader/@src)"/>
	<xsl:variable name="src_navbar" select="document(root/filenavbar/@src)"/>
	<xsl:variable name="src_footer" select="document(root/filefooter/@src)"/>
	<xsl:variable name="src_data" select="document(root/input/filedata)"/>
	
	<!-- template to load a static content -->
	<xsl:template name="Loader">
		<xsl:param name="src"/>  
		<xsl:copy-of select="$src/root/*[name() != 'namespace']"/>
	</xsl:template>

	<!-- template to load extra data content -->
	<xsl:template name="ExtraDataLoader">
		<xsl:param name="src"/>
		<xsl:copy-of select="$src/*[name() != 'namespace']"/>
	</xsl:template>
	
	<!-- template to load IE Fix content -->
	<xsl:template name="IELoader">
		<xsl:param name="src"/>
		<xsl:comment>[if IE 6]><xsl:value-of select="$src"/>&lt;![endif]</xsl:comment>
	</xsl:template>
	
	<!-- template to dinamically create menu -->
	<xsl:template name="NavLoader">
		<xsl:param name="src"/>
		<xsl:variable name="page" select="page"/>
		<xsl:copy-of select="$src/root/linkable/*"/>
		<!-- navbar link list -->
		<!--<ul id="nav_list">
			<xsl:if test="page = 'browse'">
				<xsl:copy-of select="$src/root/not_linkable/ul/li[text()='Home']"/>
			</xsl:if>
			<xsl:if test="page != 'browse'">
				<xsl:copy-of select="$src/root/linkable/ul/li[a[@accesskey='o']]"/>					
			</xsl:if>
			<xsl:if test="page = 'feedscribe'">
				<xsl:copy-of select="$src/root/not_linkable/ul/li[text()='Sign Up']"/>
			</xsl:if>
			<xsl:if test="page != 'feedscribe'">
				<xsl:copy-of select="$src/root/linkable/ul/li[a[@accesskey='s']]"/>
			</xsl:if>
			<xsl:if test="page = 'unfeedscribe'">
					<xsl:copy-of select="$src/root/not_linkable/ul/li[text()='Help']"/>
			</xsl:if>
			<xsl:if test="page != 'unfeedscribe'">
				<xsl:copy-of select="$src/root/linkable/ul/li[a[@accesskey='h']]"/>
			</xsl:if>
			<xsl:if test="page = 'manage'">
				<xsl:copy-of select="$src/root/not_linkable/ul/li/a[text()='About']"/>
			</xsl:if>
			<xsl:if test="page != 'manage'">
				<xsl:copy-of select="$src/root/linkable/ul/li[a[@accesskey='a']]"/>
			</xsl:if>
		</ul>-->
	</xsl:template>

	<!-- template to generate main content -->
	<xsl:template name="UnFeedscribeContent">
		<!-- load extra tabindex params 
		<xsl:call-template name="ExtraDataLoader">
			<xsl:with-param name="src" select="extradata/tabindex"/>
		</xsl:call-template> -->
		<!-- main tab page -->
		<div id="tab_wrapper">
			<!-- <p class="site_pos">You are here:  <a href="main_app.html">Your page</a> -&gt; Subscribe feeds</p> -->
			<form action="../cgi-bin/unfeedscribe.pl" method="post" id="subs_form">
			<h1>Cancel RSS Subscription</h1>
			<fieldset><legend>Delete a subscription</legend>
				<p>Which subscription do you want to delete?</p>
				<table id="feed_table" summary="The list of your feeds. Select wich ones you want to delete" cellspacing="0">   
					<colgroup>
						<col class="tb_check" /> 
						<col class="tb_name" />
						<col class="tb_date" />
					</colgroup>      
					<thead>
						<tr>
							<th axis="checkboxes" scope="col">Op</th>
							<th axis="feed name" scope="col">Feed Name</th>
							<th axis="subscription date" scope="col" >Subscription Date</th>
						</tr>
					</thead>
					<tbody>
						<xsl:for-each select="$src_data/userfeed/group">
							<tr class="group_title">
								<td colspan="3"><xsl:value-of select="@groupname"/></td>
							</tr>
							<!-- if got child -->
							<xsl:if test="feed">
								<xsl:for-each select="feed">
									<tr class="odd">
										<td><input type="checkbox" name ="feed_name">
											<xsl:attribute name="value"><xsl:value-of select="name"/></xsl:attribute>
										</input></td>
										<td><xsl:value-of select="name"/></td>
										<!-- date -->
										<td><xsl:value-of select="time_submit"/></td>
									</tr>
								</xsl:for-each>
							</xsl:if>
						</xsl:for-each>
					</tbody>
				</table>
				<ul id="remove_tools">
					<li><input type="submit" value="Remove Selected" /></li>
					<li><input type="reset" value="Reset" /></li>
				</ul>
				<!-- id value -->
				<input type="hidden" name="id">
					<xsl:attribute name="value"><xsl:value-of select="input/id"/></xsl:attribute>
				</input>
			</fieldset>
			</form>
		</div>
		<div id="msgCont">
		</div>
	</xsl:template>
	
	<!-- CREATE PAGE -->
	
	<!-- create page structure -->
	<xsl:template match="root">
		<html>
			<!-- head -->
			<head>
				<!-- load common code -->
				<xsl:call-template name="Loader">
					<xsl:with-param name="src" select="$src_head"/>
				</xsl:call-template>
				<!-- load extra head params -->
				<xsl:call-template name="ExtraDataLoader">
					<xsl:with-param name="src" select="extradata/head"/>
				</xsl:call-template>
				<!-- load ie fix -->
				<xsl:call-template name="IELoader">
					<xsl:with-param name="src" select="$src_head_ie/root/common"/>
				</xsl:call-template>
				<xsl:call-template name="IELoader">
					<xsl:with-param name="src" select="extradata/IEFix"/>
				</xsl:call-template>
				<!-- pagetitle -->
				<title><xsl:value-of select="pagetitle"/></title>
			</head>
			<body>
				<!-- body onload attribute -->
				<xsl:if test="extradata/body/onload/text() != ''">
					<xsl:attribute name="onLoad"><xsl:value-of select="extradata/body/onload"/></xsl:attribute>
				</xsl:if>
				<!-- header -->			
				<xsl:call-template name="Loader">
					<xsl:with-param name="src" select="$src_header"/>
				</xsl:call-template>
				<!-- navbar -->
				<div id="main_app_navigation">
					<xsl:call-template name="NavLoader">
						<xsl:with-param name="src" select="$src_navbar"/>
					</xsl:call-template>
				</div>
				<!-- content -->
				<xsl:call-template name="UnFeedscribeContent">
					<!--<xsl:with-param name="src" select="$src_footer"/>-->
				</xsl:call-template>				
				<!-- footer -->
				<xsl:call-template name="Loader">
					<xsl:with-param name="src" select="$src_footer"/>
				</xsl:call-template>				
			</body>
		</html>
	</xsl:template>
	
</xsl:stylesheet>	
